import pymongo
from get_field_name.config import *

client = pymongo.MongoClient(MONGO_URL)
db = client[MONGO_DB]


def save_data(table, name_list):
    print("save to db[" + table + "]")
    data_len = len(name_list)
    for item in name_list:
        db[table].save(item)
    print("共存入"+str(data_len)+"条数据到"+table+"数据库！")